import java.util.HashMap;
import java.util.Map;

public class Solution2170 {
    public int minimumOperations(int[] nums) {
        if (nums.length==1){
            return 0;
        }
        Map<Integer,Integer> map1=new HashMap<>();
        for (int i=0;i<nums.length;i+=2){
            map1.put(nums[i],map1.getOrDefault(nums[i],0)+1);
        }
        int m1=-1,m2=-1;
        for (Map.Entry<Integer, Integer> entry : map1.entrySet()) {
            if (entry.getValue()>map1.getOrDefault(m1,-1)){
                m2=m1;
                m1=entry.getKey();
            }else if (entry.getValue()>map1.getOrDefault(m2,-1)){
                m2=entry.getKey();
            }
        }
        Map<Integer,Integer> map2=new HashMap<>();
        for (int i=1;i<nums.length;i+=2){
            map2.put(nums[i],map2.getOrDefault(nums[i],0)+1);
        }
        int m3=-1,m4=-1;
        for (Map.Entry<Integer, Integer> entry : map2.entrySet()) {
            if (entry.getValue()>map2.getOrDefault(m3,-1)){
                m4=m3;
                m3=entry.getKey();
            }else if (entry.getValue()>map2.getOrDefault(m4,-1)){
                m4=entry.getKey();
            }
        }
        if (m1!=m3){
            return nums.length-map1.get(m1)-map2.get(m3);
        }else{
            if (m2==-1 && m4==-1){
                return nums.length/2;
            }else if (m2==-1){
                return nums.length-map1.get(m1)-map2.get(m4);
            }else if (m4==-1){
                return nums.length-map2.get(m3)-map1.get(m2);
            }else {
                return nums.length - Math.max(map1.get(m1) + map2.get(m4), map1.get(m2) + map2.get(m3));
            }
        }
    }

    public static void main(String[] args) {
        System.out.println(new Solution2170().minimumOperations(new int[]{2,1,4,1,1}));
    }
}
